import 'package:flutter/services.dart';
import 'package:my_flutter_test/utils/logger.dart';

///网络模块
class NetManager {
  static Future<String?> get getPlatformVersion async {
    var _platform = const MethodChannel('zzcflutterplugin');
    String? version = await _platform.invokeMethod("getPlatformVersion");
    return version; //version!.substring(1,2);
  }

  static String xxxx(String from, [String? device = "XXXX"]) {
    if (device != null) {
    }
    print('device $from , $device');
   var test= new Test.help();
    // test.x
    return "";
  }
  static String getErrorMsg([String? error]) => error ?? 'Unknown Error!';

  static Future<Object?> post(Map params) async {

    var _network = const MethodChannel('jys.network');
    Object? response = await _network.invokeMethod("post", params);
    return response;
  }
}

class Test {
  int? x, y;

  Test(int x, int y) {
    this.x = x;//this.x指向的是当前Test类里面的变量int x
    this.y = y;
  }
  // 命名构造
  Test.help() {
    x = 5;
    y = 10;
    print('x=${x}, y = ${y}');
  }
}

